home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2116 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  46 lines

  1. Path: news.missouri.edu!NewsWatcher!user
  2. From: surgsw@mizzou1.missouri.edu (Joel Weinstein)
  3. Newsgroups: comp.lang.c
  4. Subject: Problem with c code, please help!
  5. Date: Fri, 19 Jan 1996 01:48:53 -0700
  6. Organization: University of Missouri - Columbia
  7. Message-ID: <surgsw-1901960148530001@128.206.206.86>
  8. NNTP-Posting-Host: mizzou-ts10-09.missouri.edu
  9.  
  10. I have been trying to get this very simple piece of code to work for
  11. hours.  What is the problem???????
  12.  
  13. #include <stdio.h>
  14.  
  15. main()
  16. {
  17.    int i=0;
  18.    char  word[100], c;
  19.    printf("Enter a word:   ");
  20.    while( (c = getchar()) != '\n')  {
  21.       *word = c;
  22.       word == word + 1;
  23.    }  
  24.    printf("You entered:  ");  
  25.    *word = 0;
  26.    while( *word != '\n' )   
  27.    {  
  28.       putchar( *word );
  29.       word == word + 1; 
  30.    }
  31. }  
  32.  
  33. I think the problem I am having is due to my not knowing when to use the
  34. '*' operator.  When do you use it?  Also, why won't my goddam compiler let
  35. me do word++; instead of word == word +1;   I also tried to do *word++;
  36. and it didn't work, what is the deal with that.  It won't let me put word
  37. = word + 1;.  It insists on the double ='s.  Why is that?
  38.  
  39. Please send e-mail.
  40.  
  41. Joel
  42.  
  43. ps: is there a way to find out what exactly error messages mean?  I kept
  44. getting something similar to: not an Ivalue.  It would be nice if I knew
  45. what the hell that meant.
  46.